package com.spzx.user.api.service;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.domain.R;
import com.spzx.user.api.domain.UpdateUserLogin;
import com.spzx.user.api.domain.UserInfo;
import com.spzx.user.api.factory.RemoteUserInfoFallbackFactory;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "remoteUserInfoService",value = "spzx-user",fallbackFactory = RemoteUserInfoFallbackFactory.class)
public interface RemoteUserInfoService {

    @PostMapping("/userInfo/register")
    R<Boolean> register(@RequestBody UserInfo userInfo, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "用户登录")
    @GetMapping("/userInfo/getUserInfoByUsername/{username}")
    R<UserInfo> getUserInfoByUsername(@PathVariable("username") String username, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @Operation(summary = "登录更新")
    @PostMapping("/userInfo/updateUserLogin")
    R<Boolean> updateUserLogin(@RequestBody UpdateUserLogin updateUserLogin, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);

}
